<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html><head><title>QAbstractMessageHandler Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
td.postheader { font-family: sans-serif }
tr.address { font-family: sans-serif }
body { background: #ffffff; color: black; }
</style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">&#160;&#160;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&#160;&#183; <a href="classes.html"><font color="#004faf">All Classes</font></a>&#160;&#183; <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QAbstractMessageHandler Class Reference<br /><sup><sup>[<a href="qtxmlpatterns.html">QtXmlPatterns</a> module]</sup></sup></h1><p>The QAbstractMessageHandler class provides a callback interface
for handling messages. <a href="#details">More...</a></p>

<p>Inherits <a href="qobject.html">QObject</a>.</p><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qabstractmessagehandler.html#QAbstractMessageHandler">__init__</a></b> (<i>self</i>, QObject&#160;<i>parent</i>&#160;=&#160;None)</li><li><div class="fn" /><b><a href="qabstractmessagehandler.html#handleMessage">handleMessage</a></b> (<i>self</i>, QtMsgType&#160;<i>type</i>, QString&#160;<i>description</i>, QUrl&#160;<i>identifier</i>, QSourceLocation&#160;<i>sourceLocation</i>)</li><li><div class="fn" /><b><a href="qabstractmessagehandler.html#message">message</a></b> (<i>self</i>, QtMsgType&#160;<i>type</i>, QString&#160;<i>description</i>, QUrl&#160;<i>identifier</i>&#160;=&#160;QUrl(), QSourceLocation&#160;<i>sourceLocation</i>&#160;=&#160;QSourceLocation())</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QAbstractMessageHandler class provides a callback interface
for handling messages.</p>
<p>QAbstractMessageHandler is an abstract base class that provides
a callback interface for handling messages. For example, class
<a href="qxmlquery.html">QXmlQuery</a> parses and runs an <a href="xmlprocessing.html">XQuery</a>. When it detects a compile or
runtime error, it generates an appropriate error message, but
rather than output the message itself, it passes the message to the
<a href="qabstractmessagehandler.html#message">message</a>()
function of its QAbstractMessageHandler. See <a href="qxmlquery.html#setMessageHandler">QXmlQuery.setMessageHandler</a>().</p>
<p>You create a message handler by subclassing
QAbstractMessageHandler and implementing <a href="qabstractmessagehandler.html#handleMessage">handleMessage</a>().
You then pass a pointer to an instance of your subclass to any
classes that must generate messages. The messages are sent to the
message handler via the <a href="qabstractmessagehandler.html#message">message</a>() function,
which forwards them to your handleMessge(). The effect is to
serialize the handling of all messages, which means your
QAbstractMessageHandler subclass is thread safe.</p>
<p>A single instance of QAbstractMessageHandler can be called on to
handle messages from multiple sources. Hence, the content of a
message, which is the <i>description</i> parameter passed to
<a href="qabstractmessagehandler.html#message">message</a>() and
<a href="qabstractmessagehandler.html#handleMessage">handleMessage</a>(),
must be interpreted in light of the context that required the
message to be sent. That context is specified by the
<i>identifier</i> and <i>sourceLocation</i> parameters to <a href="qabstractmessagehandler.html#message">message</a>() <a href="qabstractmessagehandler.html#handleMessage">handleMessage</a>().</p>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QAbstractMessageHandler" />QAbstractMessageHandler.__init__ (<i>self</i>, <a href="qobject.html">QObject</a>&#160;<i>parent</i>&#160;=&#160;None)</h3><p>The <i>parent</i> argument, if not None, causes <i>self</i> to be owned by Qt instead of PyQt.</p><p>Constructs a <a href="qabstractmessagehandler.html">QAbstractMessageHandler</a>. The
<i>parent</i> is passed to the <a href="qobject.html">QObject</a>
base class constructor.</p>


<h3 class="fn"><a name="handleMessage" />QAbstractMessageHandler.handleMessage (<i>self</i>, <a href="qtcore.html#QtMsgType-enum">QtMsgType</a>&#160;<i>type</i>, QString&#160;<i>description</i>, <a href="qurl.html">QUrl</a>&#160;<i>identifier</i>, <a href="qsourcelocation.html">QSourceLocation</a>&#160;<i>sourceLocation</i>)</h3><p>This method is abstract and should be reimplemented in any sub-class.</p><p>This function must be implemented by the sub-class. <a href="qabstractmessagehandler.html#message">message</a>() will call this
function, passing in its parameters, <i>type</i>,
<i>description</i>, <i>identifier</i> and <i>sourceLocation</i>
unmodified.</p>


<h3 class="fn"><a name="message" />QAbstractMessageHandler.message (<i>self</i>, <a href="qtcore.html#QtMsgType-enum">QtMsgType</a>&#160;<i>type</i>, QString&#160;<i>description</i>, <a href="qurl.html">QUrl</a>&#160;<i>identifier</i>&#160;=&#160;QUrl(), <a href="qsourcelocation.html">QSourceLocation</a>&#160;<i>sourceLocation</i>&#160;=&#160;QSourceLocation())</h3><p>Sends a message to this message handler. <i>type</i> is the kind
of message being sent. <i>description</i> is the message content.
The <i>identifier</i> is a URI that identifies the message and is
the key to interpreting the other arguments.</p>
<p>Typically, this class is used for reporting errors, as is the
case for <a href="qxmlquery.html">QXmlQuery</a>, which uses a
<a href="qabstractmessagehandler.html">QAbstractMessageHandler</a>
to report compile and runtime <a href="xmlprocessing.html">XQuery</a> errors. Hence, using a <a href="qurl.html">QUrl</a> as the message <i>identifier</i> is was
inspired by the explanation of <a href="http://www.w3.org/TR/xquery/#errors">error handling in the XQuery
language</a>. Because the <i>identifier</i> is composed of a
namespace URI and a local part, identifiers with the same local
part are unique. The caller is responsible for ensuring that
<i>identifier</i> is either a valid <a href="qurl.html">QUrl</a> or
a default constructed <a href="qurl.html">QUrl</a>.</p>
<p><i>sourceLocation</i> identifies a location in a resource (i.e.,
file or document) where the need for reporting a message was
detected.</p>
<p>This function unconditionally calls <a href="qabstractmessagehandler.html#handleMessage">handleMessage</a>(),
passing all its parameters unmodified.</p>
<p><b>See also</b> <a href="http://www.w3.org/TR/xquery/#errors">http://www.w3.org/TR/xquery/#errors</a>.</p>
<address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt&#160;snapshot-4.9.5-9eb6aac99275 for X11</td><td align="center" width="50%">Copyright &#169; <a href="http://www.riverbankcomputing.com">Riverbank&#160;Computing&#160;Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2012</td><td align="right" width="25%">Qt&#160;4.8.3</td></tr></table></div></address></body></html>